home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8497 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How do I modify a character string that's declared as an array of char?
  5. Date: 02 Mar 1996 18:56:40 GMT
  6. Organization: Los Alamos National Laboratory
  7. Distribution: world
  8. Message-ID: <TANMOY.96Mar2115640@qcd.lanl.gov>
  9. References: <4gj2nl$840@mirzam.usc.edu> <4gqo63$2pr@newshost.cyberramp.net>
  10.     <TANMOY.96Feb25203754@qcd.lanl.gov> <4h75t1$q7s@newshost.cyberramp.net>
  11. NNTP-Posting-Host: qcd.lanl.gov
  12. Mime-Version: 1.0
  13. Content-Type: text
  14. In-reply-to: sinan@cyberramp.net's message of 1 Mar 1996 15:42:25 GMT
  15.  
  16. In article <4h75t1$q7s@newshost.cyberramp.net>
  17. sinan@cyberramp.net (John Noland) writes:
  18.  
  19. <snip>
  20. JN: ANSI treats &mydata as a pointer to the entire array. Some
  21. compilers treat  
  22. JN: &mydata as a pointer to the first element. Some compilers disallow
  23. &mydata 
  24. JN: constructs altogether. Hence, this is not a portable construct.:-)
  25. Use it if  
  26. JN: you like, me, I'll pretend it's not legal. Preferring instead:
  27. JN: 
  28. JN: char (*p)(50);
  29. JN: 
  30. JN: p = (char (*)[50]) mydata;
  31. JN: 
  32.  
  33. The mindset that ANSI is not portable is soon becoming outdated: Most
  34. people I know of have access to at least almost ANSI compilers. 
  35.  
  36. According to ANSI, the meaning of (char(*)[50])mydata depends on the
  37. implementation. &mydata is defined by the standard.
  38.  
  39. JN: 
  40. JN: Just my opinion. Your code doesn't have to be portable.
  41. JN: 
  42.  
  43. I believe that strict ANSI code is completely portable today.
  44.  
  45. Cheers
  46. Tanmoy
  47. --
  48. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  49. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  50. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  51. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  52. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  53. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  54.